#include <sys/wait.h>
#include "../ourhdr.h"

/***
 *  
 */

int main(void)
{
    char line[MAXLINE];
    FILE *fpin;
    if((fpin = popen("./myuclc","r")) == NULL)
    {
        err_sys("popen error");
    }

    for(;;)
    {
        fputs("prompt> ", stdout);
        fflush(stdout);
        if(fgets(line,MAXLINE, fpin) == NULL)
        {
            break;
        }
        if(fputs(line,stdout) == EOF)
        {
            err_sys("fputs error to pipe");
        }
    }

    if(fclose(fpin) == -1)
    {
        err_sys("pclose error");
    }
    putchar('\n');
    exit(0);
}